Don't look at custom build targets for output locs
authorAlex Crichton <alex@alexcrichton.com>
Mon, 10 Nov 2014 17:22:04 +0000 (09:22 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 10 Nov 2014 17:23:14 +0000 (09:23 -0800)
They don't have any! We also care more about the other targets regardless.

Closes #821

src/cargo/ops/cargo_rustc/mod.rs
tests/test_cargo_compile_custom_build.rs

index 6c461135e73879022bd619cada4eb7cbac19a971..89f4217daa541eafd70974c19302e3e6e4da0b1e 100644 (file)
@@ -71,7 +71,7 @@ pub fn rustc_version() -> CargoResult<(String, String)> {
 fn uniq_target_dest<'a>(targets: &[&'a Target]) -> Option<&'a str> {
     let mut curr: Option<Option<&str>> = None;
 
-    for t in targets.iter() {
+    for t in targets.iter().filter(|t| !t.get_profile().is_custom_build()) {
         let dest = t.get_profile().get_dest();
 
         match curr {
index cd143bc9c4f105f985d4c395ffdd6d00c3490e80..9c1c742c2179e629bfdc7ef23dee32885d838725 100644 (file)
@@ -795,3 +795,21 @@ test!(code_generation {
 Hello, World!
 ", compiling = COMPILING, running = RUNNING).as_slice()));
 })
+
+test!(release_with_build_script {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.5.0"
+            authors = []
+            build = "build.rs"
+        "#)
+        .file("src/lib.rs", "")
+        .file("build.rs", r#"
+            fn main() {}
+        "#);
+
+    assert_that(p.cargo_process("build").arg("-v").arg("--release"),
+                execs().with_status(0));
+})